﻿using Report_Unity.Basic;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Report_IDal.Basic
{
    public interface IBaseDal<T> where T : class
    {
        DbContext DbContext { get; set; }
        IQueryable<T> Get(Expression<Func<T, bool>> whereLambda);
        IQueryable<T> GetAsNoTracking(Expression<Func<T, bool>> whereLambda);

        IQueryable<T> GetPage<s>(int pageIndex, int pageSize, out int totalCount, System.Linq.Expressions.Expression<Func<T, bool>> whereLambda, System.Linq.Expressions.Expression<Func<T, s>> orderLambda, bool flag = true);

        bool Add(T t);
        bool AddList(List<T> list);
        bool Up(T t);
        bool UpList(List<T> list);
        bool UpArray(params T[] ts);
        bool Del(T t);
        bool DelList(List<T> list);
        bool SaveChanges();
        List<T> GetSelectIn(Expression<Func<T, string>> keyField, List<string> list);
        int GetNextSort(Expression<Func<T, bool>> whereLambda, Expression<Func<T, int>> selector);
        ResultInfo MoveObj(Expression<Func<T, bool>> whereLambda, Func<T, bool> whereid, Expression<Func<T, int>> keySelector, string dirc);
        long GetNextId(Expression<Func<T, long>> fnnc);
        string GetNextId(Expression<Func<T, string>> fnnc, bool year = false, bool month = false, bool day = false, int num = 7);
        int GetNextId(Expression<Func<T, int>> fnnc);
    }
}
